package com.yu.crm;

import com.github.tobato.fastdfs.FdfsClientConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.*;
import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;


//@EnableScheduling // 开启对定时任务支持
@SpringBootApplication
@Import(FdfsClientConfig.class)
//@EnableEurekaClient
@ComponentScan(value = {
        "com.yxzz.common.annotation",
        "com.yu.crm.config",
        "com.yxzz.common.config",
        "com.yu.crm.controller",
        "com.yu.crm.service",
        "com.yu.crm.jobs",
        "com.yu.crm.ws",
        "com.yu.crm.handle"
})
@EnableFeignClients(basePackages = {"com.yu.crm.feign"})
@MapperScan(value = "com.yu.crm.mapper")
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
@PropertySource(value = {"swagger-config.properties","config.properties"})
public class YuCrmClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(YuCrmClientApplication.class, args);

//        ThreadUtil.execAsync(() -> SocketServerManager.listen(8888));
//        SocketClient.start();
    }

    /**
     * 开启WS
     *
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

}
